<?php

require_once("mantis_config.php");

if($_GET["project_id"] == ""){
	$AppUI->redirect("m=projects");
	die();
}

$forward_link = "m=projects&a=view&project_id=" . $_GET["project_id"];

$mantis = new PHPXMLRPCClient();

$mantis->createClient($web_path_to_mantis_xmlrpc . "mantisserver.php", $domain);

$mantis->setXMLRPCDebug(0);

$query = "SELECT project_name, project_description FROM projects WHERE project_id='" . $_GET["project_id"] . "'" ;
$result = mysql_query($query)or die(mysql_error());
$row = mysql_fetch_array($result);

$project_name = $row["project_name"];
$project_description = $row["project_description"];

$mantis->resetRequest();
$mantis->setFunction("MantisRPC");
$mantis->addArg(array($mantis_user, $mantis_pass));
$mantis->addArg("project_create");
$mantis->addArg($project_name);
$mantis->addArg($project_description);
$mantis->addArg("10");

$bug = $mantis->call();

if(ERROR::isError($bug)){
	die($bug->getErrstr());
}
	
$AppUI->redirect($forward_link);
die();

?>